load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")

package(default_visibility = ["//visibility:public"])

rust_library(
    name = "ic-icrc-rosetta-runner",
    srcs = ["src/lib.rs"],
    crate_name = "ic_icrc_rosetta_runner",
    deps = [
        # Keep sorted.
        "//packages/icrc-ledger-types:icrc_ledger_types",
        "@crate_index//:anyhow",
        "@crate_index//:candid",
        "@crate_index//:tempfile",
        "@crate_index//:tokio",
    ],
)

rust_test(
    name = "ic-icrc-rosetta-runner-tests",
    srcs = ["tests/tests.rs"],
    data = [
        "//rs/canister_sandbox",
        "//rs/canister_sandbox:sandbox_launcher",
        "//rs/pocket_ic_server:pocket-ic-server",
        "//rs/replica",
        "//rs/rosetta-api/icrc1:ic-icrc-rosetta-bin",
        "//rs/rosetta-api/icrc1/client:ic-icrc-rosetta-client-bin",
    ],
    env = {
        "CANISTER_LAUNCHER": "$(rootpath //rs/canister_sandbox)",
        "POCKET_IC_BIN": "$(rootpath //rs/pocket_ic_server:pocket-ic-server)",
        "REPLICA_BIN": "$(rootpath //rs/replica)",
        "ROSETTA_BIN_PATH": "$(rootpath //rs/rosetta-api/icrc1:ic-icrc-rosetta-bin)",
        "SANDBOX_LAUNCHER": "$(rootpath //rs/canister_sandbox:sandbox_launcher)",
    },
    deps = [
        # Keep sorted.
        ":ic-icrc-rosetta-runner",
        "//packages/pocket-ic",
        "@crate_index//:candid",
        "@crate_index//:reqwest",
        "@crate_index//:tokio",
    ],
)
